package com.rec.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class GetDayByDay {
	/** 
	* 获得指定日期的前一天 
	* @param specifiedDay 
	* @return 
	* @throws Exception 
	*/ 
	public static String getSpecifiedDayBefore(String specifiedDay){ 
			//SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); 
			Calendar c = Calendar.getInstance(); 
			Date date=null; 
			try { 
			date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(specifiedDay); 
			} catch (java.text.ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			c.setTime(date); 
			int day=c.get(Calendar.DATE); 
			c.set(Calendar.DATE,day-1); 
		
			String dayBefore=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(c.getTime()); 
			return dayBefore; 
	} 
		
}
